package com.ygp.basic;

/**
 * <Description> <br>
 *
 * @author linmiaolai@sanyygp.com<br>
 * @version 1.0<br>
 * @date 2021/10/14 <br>
 */
public class TestYield {
    public static void main(String[] args) {
        Runnable task1 = () -> {
            int count = 0;
            for (;;){
                System.out.println("------>1  " + count++);
            }

        };
        Runnable task2 = () -> {
            int count = 0;
            for (;;){
                System.out.println("          ------>2  " + count++);
            }
        };

        Thread t1 = new Thread(task1, "t1");
        Thread t2 = new Thread(task2, "t2");

        t1.start();
        t2.start();
    }
}
